<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>

<%@ page import="com.conversationboard.model.*" %>
<%@ page import="com.conversationboard.view.*" %>
<%@ page import="com.conversationboard.config.*" %>
<%@ page import="java.util.List"%>
<%@ page import="com.conversationboard.cache.readcounter.ThreadCounter"%>
<%@ page import="com.conversationboard.site.Site"%>

<%
	List<ThreadCounter> popularThreads = Site.getMostPopularThreads();
	request.setAttribute("popularThreads", popularThreads);
%>

<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta name="ROBOTS" content="NOINDEX"></meta>
	<title><%=Configuration.getInstance().getSiteName()%></title>
	<link rel="stylesheet"title="Conversation Board" type="text/css" href="${contextPath}/Stylesheets/<%=StyleSheets.getStyleSheetFileName(request.getCookies())%>">
</head>

<body>

	<%= MainMenu.display(request.getUserPrincipal()) %>

	
	<div class="headingblock">
		<h1>Top 50 Most Read Threads</h1>
	</div>

	<div class="mainblock">

		<p>Shows the threads that have been read the most in the past hour, updated every hour.</p>
		
		<table class="table">
		
			<tr class="header">
				<th class="cell">Thread</th>
				<th class="cell">Total Number of Reads</th>
				<th class="cell"><%=Configuration.getInstance().getSiteName()%> Reads</th>
				<th class="cell">External Site Reads</th>
				<th class="cell">No Referrer (can't tell)</th>
			</tr>
			
			<c:forEach var="thread" items="${popularThreads}">
				<c:if test="${thread.publicThread}">
					<tr class="row">
						<td class="cell"><a href="${contextPath}/ThreadSelectedControllerServlet?boardid=${thread.boardId}&threadid=${thread.threadId}">${thread.title}</a></td>
						<td class="cell">${thread.fromSiteCounter + thread.searchEngineCounter + thread.noReferrerCounter}</td>
						<td class="cell">${thread.fromSiteCounter}</td>
						<td class="cell">${thread.searchEngineCounter}</td>
						<td class="cell">${thread.noReferrerCounter}</td>
					</tr>
				</c:if>
			</c:forEach>

		</table>
	</div>
	
	<!--<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>-->
	<!--<script type="text/javascript">_uacct = "UA-1148679-1";urchinTracker();</script>--> 

</body>
</html>
